#include<iostream>
#include<vector>
#include<queue>
#include<cmath>
using namespace std;
const int N = 10100;
struct node
{
	int x;
	int y;
}a[N];
typedef pair<int, double > PII;
vector<PII> edges[N];
double dist[N];
bool st[N];
const int INF =0x3f3f3f3f;
int n, m;
int s, t;
double calc(int x, int y)
{
	double  l = (a[x].x - a[y].x) * (a[x].x - a[y].x);
	double r = (a[x].y - a[y].y) * (a[x].y - a[y].y);
	return sqrt(l + r);
}
void spfa()
{
	for (int i = 1;i <= n;i++) dist[i] = INF;

	queue<int> q;
	q.push(s);
	dist[s] = 0;
	st[s] = true;
	while (q.size())
	{
		int u = q.front();
		q.pop();
		st[u] = false;
		for (auto& t : edges[u])
		{
			int v = t.first;double w = t.second;
			if (dist[u] + w < dist[v])
			{
				dist[v] = dist[u] + w;
				if (!st[v])
				{
					q.push(v);
					st[v] = true;
				}
			} 
			if (dist[v] + w < dist[u])
			{
				dist[u] = dist[v] + w;
				if (!st[u])
				{
					q.push(u);
					st[u] = true;
				}
			}
		}
	}
}
int main()
{
	//因为这个题是无向图（两个店之间可以来回走）所以得跑两遍判断能否更新dist
	cin >> n;
	for (int i = 1;i <= n;i++)
	{
		cin >> a[i].x >> a[i].y;
	}
	cin >> m;
	for (int i = 1;i <= m;i++)
	{
		int x = 0, y = 0;
		cin >> x >> y;
		edges[x].push_back({ y,calc(x,y)});
		edges[y].push_back({ x,calc(x,y) });//无向图所以得存两次！！！
	}
	cin >> s >> t; 
	spfa();
	printf("%.2lf\n", dist[t]);
	return 0;
}